
import {
    Service
} from "./request";

const apiDict: object = {
    inference: "inference/",
    processInference: "process_inference/",
    finetuneStart: "finetune/start/",
    finetuneStatus: "finetune/status/",
    searchConfig: "search_config/",
    editConfig: "edit_config/",
    rollMonitor: "roll_monitor/",
    getLog: "get_log/",
}
const downloadBoldList = ["info"]
export function $Http(url: string, paramsDict: object, method: string = "get", type: string = ""): Promise<any> {

    const http: object = {
        method: method,
        url: apiDict[url],
        Headers: {
            "Content-Type": type === "file" ? "multipart/form-data" : "application/json",
        },
        responseType: downloadBoldList.includes(url) && "arraybuffer"
    }
    http[(method === "post" || method === "put") ? "data" : "params"] = paramsDict
    return Service(
        http
    )
}



